<?php
// Library File
include 'lib/library.php';

// URL address
$addr = address();

// Local address
$rel_addr = relative_address();

// Database Connection
include $rel_addr.'/lib/mysql_connect.inc';

// Header File
include $rel_addr.'/lib/header.php';

// Footer File
include $rel_addr.'/lib/footer.php';

$title = 'Registration';
$subtitle = 'Registration Page';

$content .= '
		<div class="formfield">
			<div class="formcontent" id="formcontent">
';
			include $rel_addr.'/handle/register_handle.php';
$content .= '
			</div>
			<div class="formcontent whole">
			<div class="formhelp register">
			<h3>Tooltips</h3>
			<P>The information displayed on your profile can be changed later.</P>
			</div>
			
			<div class="formcontent register">
					<form action="'.$addr.this_page().'" method="POST">
';

		// Member type
		$member_type = $_POST['type'];


		// FORM
		$content .= '
			<div class="middle">
			Fields with the <div class="required">symbol are required fields.</div>
			</div>
		';
		
		
// If member type is set
// change the form
if(isset($member_type)){

	// Change form depending on member type
	switch($member_type){
		case 'NGO':case 'BUS':
			// FORM
			;
			
			if($member_type == 'NGO'){
				$type = 'organization';
			}else if($member_type == 'BUS'){
				$type = 'business';
			}
			
			
			$content .= '<h2>'.ucfirst($type).' Info:</h2>';
			
			$content .= '
			<div class="required">
				<P>
				<label for="org_name">Name: </label>
				<input type="text" size="20" name="org_name" value="'.$name.'" OnClick="this.document.all.formhelp.style.color=\'#00000\'" />
				<span class="formhelp">
				<P>Please enter the '.$type.'\'s name.</P>
				</span>
				</P>
			</div>
				
			<div class="required">
				<P>
				<label for="email">Email: </label>
				<input type="text" size="20" name="email" value="'.$email.'" />
				<span class="formhelp">
				<P>Please enter the '.$type.'\'s email address.</P>
				</span>
				</P>
			</div>
		
			<div>
			<P><label for="phone">Phone #: </label>
				(<input type="text" size="3" name="area_code" value="'.$_POST['area_code'].'" />)
				<input type="text" size="3" name="phone_3" value="'.$_POST['phone_3'].'" /> -
				<input type="text" size="4" name="phone_4" value="'.$_POST['phone_4'].'" />
				<span class="formhelp">
				<P>Please enter the '.$type.'\'s phone number.</P>
				</span>
			</P>
			</div>
			
			<div class="required">
				<P>
				<label for="address1">Address Line 1: </label>
				<input type="text" size="20" name="address1" value="'.$address_line1.'" />
				<span class="formhelp">
				<P>Please enter the street address of the '.$type.'.</P>
				</span>
				</P>
			</div>
			
			<div>
				<P>
				<label for="address2">Address Line 2: </label>
				<input type="text" size="20" name="address2" value="'.$address_line2.'" />
				<span class="formhelp">
				<P>Please enter the suite number of the '.$type.' if applicable.</P>
				</span>
				</P>
			</div>
			
			<P>
				<div class="required">
					<P>
					<label for="city">City: </label>
					<input type="text" size="10" name="city" value="'.$city.'" /> 
					<span class="formhelp">
					<P>Please enter the city for the '.$type.'.</P>
					</span>
					</P>
				</div>
			
				<div class="required">
					<P>
					<label for="state">State: </label>
					<input type="text" size="3" name="state" value="'.$state.'" /> 
					<span class="formhelp">
					<P>Please enter the state for the '.$type.'.</P>
					</span>
					</p>
				</div>
	
				<div class="required">
					<p>
					<label for="zip">Zip Code: </label>
					<input type="text" size="10" name="zip" value="'.$zipcode.'" />
					<span class="formhelp">
					<P>Please enter the zipcode for the '.$type.'.</P>
					</span>
					</P>
				</div>
			</P>
			
			<div style="position:relative">
			<P>
			<label for="website">Website: </label>
			http://<input type="text" size="20" name="website" value="'.$_POST['website'].'" />
				<span class="formhelp">
				<P>Please enter the website address of the '.$type.'.</P>
				</span>
			</P>
			</div>
			
			<br />
			
			<h2>User Info:</h2>
			
			<div class="required">
				<P>
				<label for="username">Username: </label>
				<input type="text" size="20" name="username" maxlength="20" value="'.$username.'"  />
				<span class="formhelp">
				<P>Please enter a username for the '.$type.'.</P>
				</span>
				</P>
			</div>
				
			<div class="required">
				<P>
				<label for="password">Password: </label>
				<input type="password" size="20" name="password" value="'.$_POST['password'].'" />
				<span class="formhelp">
				<P>Please enter a password for the '.$type.'.</P>
				</span>
				</P>
			</div>
			
			<div class="required">
				<P>
				<label for="chk_password">Verify Password: </label>
				<input type="password" size="20" name="chk_password" value="'.$verify_password.'" />
				<span class="formhelp">
				<P>Please verify the password.</P>
				</span>
				</P>
			</div>
			
			
			';
			break;
		
		case 'IND':
			// FORM
			$content .= '
			
			<h2>Contact Info:</h2>
			
			<P>
			<div class="required">
				<P>
				<label for="name">Name: </label>
				<input type="text" size="10" name="first_name" value="'.$_POST['first_name'].'"  />
				<input type="text" size="2" name="middle_initial" value="'.$_POST['middle_initial'].'" />
				<input type="text" size="10" name="last_name" value="'.$_POST['last_name'].'" />
				<input type="text" size="2" name="suffix" value="'.$_POST['suffix'].'" />
				<span class="formhelp">
				<P>Please enter a firstname, a middle initial (if applicable), a last name, and a suffix if necessary.</P>
				</span>
				</P>
			</div>
			</P>
			
			<div class="required">
				<P>
				<label for="email">Email: </label>
				<input type="text" size="20" name="email" value="'.$email.'" />
				<span class="formhelp">
				<P>Please enter your email address.</P>
				</span>
				</P>
			</div>
			
			<div>
			<P><label for="phone">Phone #: </label>
				(<input type="text" size="3" name="area_code" value="'.$_POST['area_code'].'" />)
				<input type="text" size="3" name="phone_3" value="'.$_POST['phone_3'].'" /> -
				<input type="text" size="4" name="phone_4" value="'.$_POST['phone_4'].'" />
				<span class="formhelp">
				<P>Please enter your phone number.</P>
				</span>
			</P>
			</div>
			
			<div class="required">
				<P>
				<label for="address1">Address Line 1: </label>
				<input type="text" size="20" name="address1" value="'.$address_line1.'" />
				<span class="formhelp">
				<P>Please enter your street address.</P>
				</span>
				</P>
			</div>
			
			<div>
				<P>
				<label for="address2">Address Line 2: </label>
				<input type="text" size="20" name="address2" value="'.$address_line2.'" />
				<span class="formhelp">
				<P>Please enter your apartment number if applicable.</P>
				</span>
				</P>
			</div>
			
			<P>
			<div class="required">
				<P>
				<label for="city">City: </label>
				<input type="text" size="10" name="city" value="'.$city.'" /> 
				<span class="formhelp">
				<P>Please enter your city.</P>
				</span>
				</P>
			</div>
			
			<div class="required">
				<P>
				<label for="state">State: </label>
				<input type="text" size="3" name="state" value="'.$state.'" /> 
				<span class="formhelp">
				<P>Please enter your state.</P>
				</span>
				</P>
			</div>
			
			<div class="required">
				<P>
				<label for="zip">Zip Code: </label>
				<input type="text" size="10" name="zip" value="'.$zipcode.'" />
				<span class="formhelp">
				<P>Please enter your phone number.</P>
				</span>
				</P>
			</div>
			</P>
			
			<br />
			
			<h2>User Info:</h2>
			
			<P>	
			<div class="required">
				<P>
				<label for="bday">Birthdate: </label>
				<input type="text" size="2" name="month" value="'.$_POST['month'].'" /> / 
				<input type="text" size="2" name="day" value="'.$_POST['day'].'" /> / 
				<input type="text" size="4" name="year" value="'.$_POST['year'].'" />
				<span class="formhelp">
				<P>Please enter your birthday in MM/DD/YYYY format.</P>
				</span>
				</P>
			</div>
			</P>
			<div class="required" style="position:relative">
				<P>
				<label for="gender">Gender: </label>
				<select name="gender">
				<option value="'.$gender.'">'.$gender.'</option>
				<option value="Male">Male</option>
				<option value="Female">Female</option>
				</select>
				<span class="formhelp">
				<P>Please select your gender.</P>
				</span>
				</P>
			</div>
			
			<div style="position:relative">
				<P>
				<label for="website">Website: </label>
				http://<input type="text" size="20" name="website" value="'.$_POST['website'].'" />
				<span class="formhelp">
				<P>Please enter your website address.</P>
				</span>
				</P>
			</div
			
			<div class="required">
				<P>
				<label for="username">Username: </label>
				<input type="text" size="20" name="username" maxlength="20" value="'.$username.'" />
				<span class="formhelp">
				<P>Please enter a username for yourself.</P>
				</span>
				</P>
			</div>
			
			<div class="required">
				<P>
				<label for="password">Password: </label>
				<input type="password" size="20" name="password" value="'.$_POST['password'].'" />
				<span class="formhelp">
				<P>Please enter a password.</P>
				</span>
				</P>
			</div>
			
			<div class="required">
				<P>
				<label for="chk_password">Verify Password: </label>
				<input type="password" size="20" name="chk_password" value="'.$verify_password.'" />
				<span class="formhelp">
				<P>Please verify your password.</P>
				</span>
				</P>
			</div>
				
			';
			break;
	}
	
	
	$content .= '
			<input type="hidden" value="'.$member_type.'" name="type" />
			
			<br /><br /><br />
			
			<input type="submit" class="submit" name="submit" value="Submit" />
			
			</form>	
			</div>
			
			
		</div>
		</div>
	';

// If member type is not set
// show choices for member type
}else{
	// FORM
	$content = '
		<div class="formcontent member">
		<form action="'.$addr.this_page().'" method="POST">
		<P>Please select a member type to proceed</P>
		<P><label for="type">Member Type:</label>
			<select name="type" >
				<option value=""></option>
				<option '.click_submit().' value="NGO">NGO</option>
				<option '.click_submit().' value="BUS">Business</option>
				<option '.click_submit().' value="IND">Individual</option>
			</select>
		</P>
		
	';
	
		if(is_ie()){
			$content .= '
				<input type="submit" class="submit" name="go_to_register" value="submit" />
			';
		}
	
	$content.= '
		</form>	
		</div>

	';
}

/*
**   P U T    V A R S
**    O N    P A G E
*/
	top($title,$style);
	middle($header,$subtitle,$content);
	bottom($navigation,$footer,$dbc);
?> 
